package com.nulldev.util.gui.customSwing.fonts;

import java.awt.Font;
import java.awt.GraphicsEnvironment;

import com.nulldev.util.JVM.JVM;

public class IcoMoon {

	private static final Font cached = getFont();

	public static Font getCached() {
		return cached;
	}

	public static Font getCached(final float size) {
		return cached.deriveFont((float) size);
	}

	public static Font getFont() {
		try {
			final Font result = Font.createFont(Font.TRUETYPE_FONT, IcoMoon.class.getResourceAsStream("IcoMoon-Free.ttf"));
			GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(result);
			return result;
		} catch (Exception e) {
			JVM.errorln(e);
			return null;
		}
	}
}
